/**
 * com.future CO.,ltd.
 */

package com.future.zookeeper;

import org.apache.zookeeper.*;

import java.io.IOException;
import java.util.concurrent.CountDownLatch;

/**
 * 类说明：
 */
public class App {

    public static final String IP_PORT = "192.168.42.91:2181,192.168.42.92:2181,192.168.42.93:2181,192.168.42.94:2181";

    public static void main(String[] args) throws IOException, KeeperException, InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        ZooKeeper zooKeeper = new ZooKeeper(IP_PORT, 3000,
                new Watcher() {
                    @Override
                    public void process(WatchedEvent event) {
                        System.out.println(event.getType());
                    }
                });
        latch.countDown();
        latch.await();
        zooKeeper.create("/k2","中国".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
    }
}
